import request from '@/utils/request'
import {createBaseApi} from '@/utils/apiUtil'

export const baseUrl = '/system/user'
export const baseApiName = '用户'


// 引入通用方法
const baseApi = createBaseApi(baseUrl, baseApiName)
export const {findAll, findPage, findOneById, update, create, remove, removeIds,} = baseApi

export function findAllNoPage(params) {
    return request({
        url: `${baseUrl}/findAllNoPage`,
        method: 'get',
        params,
        apiName: `${baseApiName}列表`
    })
}

export function findChildAllPage(params) {
    return request({
        url: `${baseUrl}/findChildAllPage`,
        method: 'get',
        params,
        apiName: `${baseApiName}列表`
    })
}

export function getUserMenu(params) {
    return request({
        url: `${baseUrl}/getUserMenu`,
        method: 'get',
        params,
        apiName: `${baseApiName}`
    })
}

export function login(data) {
    return request({
        url: '/system/user/login',
        method: 'post',
        data,
        apiName: `${baseApiName}登录`
    })
}

export function getInfo() {
    return request({
        url: '/system/user/userInfo',
        method: 'get',
        apiName: `${baseApiName}信息`
    })
}

export function logout() {
    return request({
        url: '/vue-admin-template/user/logout',
        method: 'post'
    })
}

